[UR] Implement IPC physical_mem API in UR#22115
Open
ldorau wants to merge 7 commits into
Open
Conversation
slawekptak
reviewed
May 26, 2026
70701a0 to
523e104
Compare
Contributor
Author
|
Rebased |
523e104 to
4cbcfa8
Compare
Contributor
Author
|
The Offload CI job fails because of #22125 |
a9eb70a to
6dac91d
Compare
Contributor
Author
|
Rebased |
29aee2c to
4a61124
Compare
6113038 to
572be16
Compare
kswiecicki
reviewed
May 28, 2026
75afc3f to
3c08b2b
Compare
Contributor
Author
|
The Offload CI job fails because of #22125 |
879915f to
dc8e61e
Compare
dc8e61e to
95c1d4a
Compare
Contributor
Author
|
@nrspruit please review 2 files: |
Contributor
Author
|
The Offload CI job fails because of #22125 |
88e952f to
fe60cba
Compare
kswiecicki
reviewed
Jun 2, 2026
slawekptak
reviewed
Jun 2, 2026
Add four new function specs to exp-inter-process-communication.yml and update registry.yml to support IPC operations on physical memory objects: - urIPCGetPhysMemHandleExp: export an IPC handle for a physical_mem - urIPCPutPhysMemHandleExp: release the exported IPC handle - urIPCOpenPhysMemHandleExp: import an IPC handle into a physical_mem - urIPCClosePhysMemHandleExp: close the imported physical_mem Also add ENABLE_IPC flag to ur_physical_mem_flags_t in virtual_memory.yml to allow allocating physical memory that can be shared via IPC handles. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Add auto-generated files based on the IPC physical_mem spec changes (urIPCGetPhysMemHandleExp, urIPCPutPhysMemHandleExp, urIPCOpenPhysMemHandleExp, urIPCClosePhysMemHandleExp, UR_PHYSICAL_MEM_FLAG_ENABLE_IPC, UR_DEVICE_INFO_IPC_PHYSICAL_MEMORY_SUPPORT_EXP): - ur_api.h, ur_api_funcs.def, ur_ddi.h: function declarations - ur_print.h/hpp, ur_print.cpp: printing support - ur_api.cpp: API dispatch stubs - ur_ldrddi.cpp, ur_libapi.cpp: loader implementations - ur_trcddi.cpp, ur_valddi.cpp: tracing and validation layers - ur_mockddi.cpp: mock adapter - loader.def.in, loader.map.in: loader symbol exports - level_zero ur_interface_loader.cpp/.hpp: Level-Zero DDI table entries - urinfo.hpp: updated urinfo tool Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
3acc55a to
a559824
Compare
Implement urIPCGetPhysMemHandleExp, urIPCPutPhysMemHandleExp, urIPCOpenPhysMemHandleExp, and urIPCClosePhysMemHandleExp across all adapters. Level Zero v2 adapter (full implementation, Linux only): - physical_mem.hpp: extend ur_physical_mem_handle_t_ with Device, Size, EnableIpc fields - v2/physical_mem.hpp: add ZeIPCPhysMemHandleData struct (pid + DMA-BUF fd + size) for cross-process handle exchange via pidfd_getfd(2) - v2/physical_mem.cpp: chain ze_external_memory_export_desc_t in urPhysicalMemCreate when ENABLE_IPC flag is set; extend urPhysicalMemGetInfo to return context, device, size and properties; implement the four IPC functions using ZeIPCPhysMemHandleData - device.cpp: report UR_DEVICE_INFO_IPC_PHYSICAL_MEMORY_SUPPORT_EXP as true on Linux, false on Windows Level Zero v1 adapter (unsupported stubs): - physical_mem.cpp: return UR_RESULT_ERROR_UNSUPPORTED_FEATURE from all four IPC functions; urPhysicalMemCreate always passes EnableIpc=false - device.cpp: report UR_DEVICE_INFO_IPC_PHYSICAL_MEMORY_SUPPORT_EXP as false CUDA, HIP, OpenCL, Native CPU adapters: - Return UR_RESULT_ERROR_UNSUPPORTED_FEATURE from all four functions - Register function pointers in ur_interface_loader.cpp - Report UR_DEVICE_INFO_IPC_PHYSICAL_MEMORY_SUPPORT_EXP as false Offload adapter: - Return UR_RESULT_ERROR_UNSUPPORTED_FEATURE from all four functions - Register function pointers in ur_interface_loader.cpp Conformance tests: - Add urIPCGetPhysMemHandleExp.cpp, urIPCPutPhysMemHandleExp.cpp, urIPCOpenPhysMemHandleExp.cpp, urIPCClosePhysMemHandleExp.cpp with shared fixtures in urIPCPhysMemHandleExpFixtures.hpp - Update urPhysicalMemCreate.cpp to cover the ENABLE_IPC flag Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
slawekptak
reviewed
Jun 3, 2026
slawekptak
approved these changes
Jun 3, 2026
Use std::optional<ze_external_memory_export_desc_t> so the export descriptor is only created when UR_PHYSICAL_MEM_FLAG_ENABLE_IPC is set in urPhysicalMemCreate. The optional lives at function scope, keeping the pointer valid through the zePhysicalMemCreate call. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Contributor
Author
|
Updated with upstream/sycl. |
Contributor
Author
|
@nrspruit please review |
kswiecicki
approved these changes
Jun 3, 2026
Contributor
kswiecicki
left a comment
There was a problem hiding this comment.
It would be nice if the urIPCOpen... were to be tested in multi-process testcase. I'm not sure if its possible to integrate it in the current conformance testing framework. Perhaps we would need a SYCL E2E test.
kswiecicki
reviewed
Jun 3, 2026
zePhysicalMemGetProperties requires the same context that was used to create the physical memory object. Use hPhysMem->Context instead of the caller-supplied hContext, which may be a different context. Mark hContext as [[maybe_unused]] since it is now unused on Linux. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
…ysical_mem_API_in_UR
kswiecicki
approved these changes
Jun 3, 2026
Replace [[maybe_unused]] ur_context_handle_t hContext with an unnamed parameter (ur_context_handle_t) in urIPCGetPhysMemHandleExp, urIPCPutPhysMemHandleExp, and urIPCClosePhysMemHandleExp. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement
urIPCGetPhysMemHandleExp,urIPCPutPhysMemHandleExp,urIPCOpenPhysMemHandleExp, andurIPCClosePhysMemHandleExpacross all adapters.Level Zero v2 adapter (full implementation, Linux only)
Uses DMA-BUF fds exported via
zePhysicalMemGetPropertiesand cross-processfd duplication via
pidfd_getfd(2)(Linux 5.6+). New filesv2/physical_mem.hppand
v2/physical_mem.cppreplace the sharedphysical_mem.cppfor the v2 build.UR_DEVICE_INFO_IPC_PHYSICAL_MEMORY_SUPPORT_EXPistrueon Linux,falseon Windows.Level Zero v1 adapter — unsupported stubs; device info returns
false.CUDA, HIP, OpenCL, Native CPU, Offload adapters — unsupported stubs; device info
returns
falsewhere applicable.Conformance tests — four new test files (
urIPCGetPhysMemHandleExp,urIPCPutPhysMemHandleExp,urIPCOpenPhysMemHandleExp,urIPCClosePhysMemHandleExp)with shared fixtures;
urPhysicalMemCreateupdated to cover theENABLE_IPCflag.